package com.atguigu.yygh.oss.controller;

import com.atguigu.yygh.common.result.R;
import com.atguigu.yygh.oss.prop.OssProperties;
import com.atguigu.yygh.oss.service.OssService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * ClassName: OssController
 * Package: com.atguigu.yygh.oss.controller
 * Description:
 *
 * @Author: cqk
 * @Create: 2023/9/26 - 9:28
 * @Version: v1.0
 */
@RestController
@RequestMapping("/user/oss/file")
public class OssController {
    @Autowired
    private OssService ossService;


    @PostMapping("/upload")
    public R upload(MultipartFile file){
        String url = ossService.upload(file);
        return R.ok().data("url",url);
    }

}
